| Plant | Flowers | Date | lon | lat | ele |
|---|---|---|---|---|---|
| Glossoloma oblongicalyx | 4 | 2015-10-19 | -78.59093 | 0.130838 | 2270 |
| Gasteranthus quitensis | 2 | 2016-10-17 | -78.59770 | 0.120070 | 1940 |
| Kohleria affinis | 1 | 2016-12-13 | -78.59534 | 0.126746 | 2110 |
| Columnea ciliata | 3 | 2014-02-27 | -78.59934 | 0.116682 | 1960 |
| Columnea medicinalis | 1 | 2014-04-23 | -78.59372 | 0.128700 | 2130 |
| Drymonia teuscheri | 3 | 2016-07-28 | -78.59245 | 0.129393 | 2200 |
Let’s start with a traditional randomization test to get everyone comfortable with the essential result. For each random draw, calculate the mean niche overlap in hummingbird usage. Species can only bloom at site which they occur. Mantains plant abundance.
Equal probability of flowering at anytime.
## sink("model/threshold_baseline.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<-alpha[PredPlant[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - p_new[x])
## }
##
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
##
## #Intercept flowering probability
## alpha[j] ~ dnorm(0,0.386)
##
## }
##
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2955
## Unobserved stochastic nodes: 3690
## Total graph size: 17039
##
## Initializing model
Equal probability of flowering per elevation
## sink("model/threshold_baseline_site.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x],Site[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<-alpha[NewPlant[x],NewSite[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - p_new[x])
## }
##
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #Priors
##
## #Species level priors
## for (i in 1:Plants){
## for(j in 1:Sites){
##
## #Intercept flowering probability
## alpha[i,j] ~ dnorm(0,0.386)
##
## }
## }
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2955
## Unobserved stochastic nodes: 3765
## Total graph size: 21091
##
## Initializing model
Equal probability of flowering per elevation
## sink("model/threshold_baseline_site_month.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x],Site[x],Month[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<-alpha[NewPlant[x],NewSite[x],NewMonth[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - p_new[x])
## }
##
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #Priors
##
## #Species level priors
## for (i in 1:Plants){
## sigma_month[i] ~ dgamma(0.0001,0.0001)
## for(j in 1:Sites){
## alpha_site[i,j] ~ dnorm(0,0.386)
## for(k in 1:Months){
## #Intercept flowering probability
## alpha[i,j,k] ~ dnorm(alpha_site[i,j],sigma_month[i])
## }
## }
## }
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2955
## Unobserved stochastic nodes: 4860
## Total graph size: 29213
##
## Initializing model
## sink("model/threshold_attraction.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x],Site[x]] + e[Plant[x],Site[x],Month[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<- alpha[NewPlant[x],NewSite[x]] + e[NewPlant[x],NewSite[x],NewMonth[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - p_new[x])
## }
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #########################
## #autocorrelation in error
## #########################
##
## #For each of observation
## for(y in 1:Sites){
## for(x in 1:Months){
## e[1:Plants,y,x] ~ dmnorm(zeros,tauC[,])
## }
## }
##
## ##covariance among similiar species
## for(i in 1:Plants){
## for(j in 1:Plants){
## C[i,j] = exp(-lambda_cov * D[i,j])
## }
## }
##
## ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
## vCov = omega*C[,] + (1-omega) * I
## tauC=inverse(vCov*gamma)
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
## for(k in 1:Sites){
## #Intercept flowering probability
## alpha[j,k] ~ dnorm(0,0.386)
## } }
##
## #Autocorrelation priors
## gamma ~ dunif(0,5)
##
## #Strength of covariance decay
## lambda_cov ~ dunif(0,5)
## omega = 1
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2955
## Unobserved stochastic nodes: 3839
## Total graph size: 31040
##
## Initializing model
## sink("model/threshold_repulsion.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x],Site[x]] + e[Plant[x],Site[x],Month[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<- alpha[NewPlant[x],NewSite[x]] + e[NewPlant[x],NewSite[x],NewMonth[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - p_new[x])
## }
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #########################
## #autocorrelation in error
## #########################
##
## #For each of observation
## for(x in 1:Months){
## for(y in 1:Sites){
## e[1:Plants,y,x] ~ dmnorm(zeros,tauC[,])
## }
## }
## ##covariance among similiar species
## for(i in 1:Plants){
## for(j in 1:Plants){
## C[i,j] = exp(-lambda_cov * D[i,j])
## }
## }
##
## ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
## vCov = omega*C[,] + (1-omega) * I
## tauC=vCov*gamma
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
## for(k in 1:Sites){
## #Intercept flowering probability
## alpha[j,k] ~ dnorm(0,0.386)
## }
## }
##
## #Autocorrelation priors
## gamma ~ dunif(0,5)
##
## #Strength of covariance decay
## lambda_cov ~ dunif(0,5)
## omega = 1
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2955
## Unobserved stochastic nodes: 3839
## Total graph size: 31039
##
## Initializing model
# One example
Glossoloma purpureum
## # A tibble: 5 x 2
## Model p
## <chr> <dbl>
## 1 baseline 0.581
## 2 baseline_site 1
## 3 baseline_site_month 1
## 4 interaction_attraction 0.954
## 5 interaction_repulsion 1
Without baseline
## # A tibble: 4 x 2
## Model p
## <chr> <dbl>
## 1 baseline_site 1
## 2 baseline_site_month 1
## 3 interaction_attraction 0.954
## 4 interaction_repulsion 1
| Model | mean | lower | upper |
|---|---|---|---|
| baseline_site | 0.2024240 | 0.1966618 | 0.2085226 |
| baseline_site_month | 0.1812022 | 0.1748977 | 0.1879261 |
| interaction_repulsion | 0.1802629 | 0.1729516 | 0.1875285 |
| interaction_attraction | 0.1635137 | 0.1556679 | 0.1721435 |
| Model | mean | lower | upper |
|---|---|---|---|
| baseline | 0.2307659 | 0.2233611 | 0.2383207 |
| baseline_site | 0.2091269 | 0.2021064 | 0.2163815 |
| interaction_repulsion | 0.2001106 | 0.1918258 | 0.2083883 |
| baseline_site_month | 0.1997268 | 0.1930772 | 0.2067666 |
| interaction_attraction | 0.1950932 | 0.1856461 | 0.2049374 |
Columnea medicinialis v Columnea strigosa which have strong overlap in visitors
Dint["Columnea medicinalis","Columnea strigosa"]
## [1] 0.2096899
Logit E
inv.logit E
## # A tibble: 2 x 4
## # Groups: Model [2]
## Model Var1 Var2 Correlation_E
## <chr> <fct> <fct> <dbl>
## 1 interaction_attraction Columnea medicinalis Columnea stri… 0.966
## 2 interaction_repulsion Columnea medicinalis Columnea stri… -0.568
## # A tibble: 5 x 4
## # Groups: Model [5]
## Model Var1 Var2 Correlation_P
## <chr> <fct> <fct> <dbl>
## 1 baseline Columnea medicinalis Columnea stri… NA
## 2 baseline_site Columnea medicinalis Columnea stri… 0.121
## 3 baseline_site_month Columnea medicinalis Columnea stri… -0.0107
## 4 interaction_attraction Columnea medicinalis Columnea stri… 0.137
## 5 interaction_repulsion Columnea medicinalis Columnea stri… 0.118
## # A tibble: 5 x 4
## # Groups: Model [5]
## Model Var1 Var2 Correlation_Ynew
## <chr> <fct> <fct> <dbl>
## 1 baseline Columnea medicinalis Columnea s… NA
## 2 baseline_site Columnea medicinalis Columnea s… 0.121
## 3 baseline_site_month Columnea medicinalis Columnea s… -0.102
## 4 interaction_attraction Columnea medicinalis Columnea s… 0.0446
## 5 interaction_repulsion Columnea medicinalis Columnea s… 0.158
Flowering patterns
Model Fit and Prediction Fit
Comparison of the attraction and repulsion
Predictions from the best model
Supplamental figures